Skip to content

mcpx v2 plugin: permission gate for daemon_select (#1858 item (2)) - #3018

Merged
dezren39 merged 2 commits into
mainfrom
queue/3997-2841-permission-evaluate
Oct 31, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/3997-2841-permission-evaluate

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Item (2) of the #1858 SET-REMAINDER, tracked by #2841 (queue task 3997). Items are worked one at a time, own PR each; this is the first in the recorded order (2) → (1) → (4) → (3) → (5).

What

Replaces v1 daemon_select's dead permission.ask with the v2 permission domain, verified against the pinned source (packages/plugin/src/promise/permission.ts, core evaluation pipeline in packages/core/src/permission.ts, host policy-plugin precedent in packages/core/src/config/plugin/policy.ts):

  • v2/permission.ts (new): evaluateMcpxPermission — the permission.hook("evaluate") handler. It keeps the mcpx_daemon_select action at effect "ask", so a blanket allow rule can never apply a daemon choice silently; a computed deny and every other action pass through unchanged.
  • tools.ts: daemon_select now asserts through the wired gate before applying, with v1's ask payload (resources/save = target key; metadata = daemon, socket, config, started, version, servers, sessions, remember, stopOthers, others). A rejection throws out of assert, so nothing is applied. With no permission domain wired, the tool refuses and says why — the silent-apply path is gone. Header and tool description updated to match.
  • index.ts: setup registers the evaluate hook and wires ctx.permission.assert into the tool runtime.

Tests

bun test plugin/opencode/v2/ — 31 pass (was 27): hook unit tests (ask-forced / deny untouched / other actions untouched), daemon_select assert payload + rejection-applies-nothing + no-gate refusal, setup hook registration.

Remaining on #2841

(1) mcp.transform, (4) ctx.generate.text, (3) TUI select() picker, (5) v1 retirement — each its own PR, in that order.

Refs #1858, #2841


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…2), #2841)

Item (2) of the #1858 SET-REMAINDER: replace v1 daemon_select's dead
permission.ask with the v2 permission domain (verified against the
pinned promise/permission.ts).

- v2/permission.ts: DAEMON_SELECT_ACTION, the PermissionDomainLike /
  PermissionEvaluationLike slices, and evaluateMcpxPermission — the
  evaluate hook that keeps mcpx_daemon_select at effect "ask" so a
  blanket allow rule can never apply a daemon choice silently; a
  computed deny and all other actions pass through unchanged.
- tools.ts: daemon_select asserts through the wired gate before
  applying, with v1's ask payload (resources/save = target key,
  metadata = daemon/socket/config/started/version/servers/sessions/
  remember/stopOthers/others). A rejection throws, so nothing is
  applied. With no permission domain wired the tool refuses and says
  why — the silent-apply path is gone. Header + description updated.
- index.ts: McpxV2Context gains the optional permission slice; setup
  registers the evaluate hook and wires assert into the tool runtime.
- Tests (bun): hook unit tests; daemon_select assert payload +
  rejection-applies-nothing + no-gate refusal; setup registration.
  v2 suite: 31 pass.

Items (1), (3), (4), (5) of #2841 remain, in the recorded order.
@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 10:34
@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8993b7d4-fcbb-4810-aa6e-df5943efbbca
Commits

Reviewing files that changed from the base of the PR and between fa7e71b and 1108a75.

Files selected for processing: 5
  • pkgs/mcpx/plugin/opencode/v2/index.ts
  • pkgs/mcpx/plugin/opencode/v2/permission.test.ts
  • pkgs/mcpx/plugin/opencode/v2/permission.ts
  • pkgs/mcpx/plugin/opencode/v2/tools.test.ts
  • pkgs/mcpx/plugin/opencode/v2/tools.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T11:31:22.660239Z 1108a75 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 67c3d6c4dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/mcpx/plugin/opencode/v2/index.ts Resolved
The evaluate-hook registration was fire-and-forget while assertPermission was wired unconditionally: if registration rejected, a blanket allow rule could let permission.assert resolve without a prompt and daemon_select would apply an unconfirmed choice (including stopOthers shutdowns). wirePermissionGate now awaits registration and hands out the assert callback only on success; a failed registration leaves daemon_select refusing, as a host with no permission domain already did. Regression tests cover success, rejection, and no-domain.
@dezren39

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 1108a75090

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant